#include<iostream>
#include<cmath>
using namespace std;
const int maxm = 100000;
double a[maxm];
double b[maxm];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		cin >> b[i];

	}
	double j;
	for (int c = 0; c < n; c++) {
		if (a[c] > b[c])
			j = ceil(a[c] / b[c] );
		else
			j = ceil(b[c] / a[c]);
		cout << j << endl;
	}


	return 0;
}



//int main() {
//	double i;
//	cin >> i;
//	i = ceil(i);
//	cout << i << endl;
//	return 0;
//
//}